package account

import "fmt"

type account struct {
	accountName string
	money float64
	password string
}

func NewAccount(accountName string) *account {
	if len(accountName) >= 6 && len(accountName) <= 10 {
		return &account {
			accountName : accountName
		}
	} else {
		fmt.Println("账号长度必须在6-10之间")
		return nil
	}

}

func (a account) SetMoney(money float64) {
	if money > 20 {
		a.money = money
	} else {
		fmt.Println("余额必须大于20..")
	}
}

func (a account) GetMoney() float64 {
	return a.money
}

func (a account) SetPassword(password string) {
	if len(password) == 6 {
		a.password = password
	} else {
		fmt.Println("密码长度必须是6位")
	}
}

func (a account) GetPassword() string {
	return a.password
}